<?php
include "../../../lib/list.php";
if($_POST['mode']=='modify_bumun'){$no = $_POST['chk_no'];}
if($_POST['mode']=='modify_bumun_query'){
$no = $_POST['chk_no'];
$bumun_no = $_POST['bumun_no'];
if(!$bumun_no){
	echo("
    <script>
      window.alert('부문을 선택해주세요');
      </script>");
}
else if(!$no){
	echo("
					    <script>
					      window.alert('입력된 상품이 없습니다.');
					    </script>		
								");
}
else{
	for($i=0;$i<count($no);$i++){
	$query = "
		UPDATE uatp_product SET 
		bumun_no = '$bumun_no' WHERE uatp_product.no = '$no[$i]' LIMIT 1
		";
	mysql_query($query);
	}
	mysql_close();
	echo "<script>
			window.alert('부문을 일괄 수정하였습니다.');
			window.close();</script>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<link rel="stylesheet" href="../../../css/insert.css" type="text/css"></link>
<link rel="stylesheet" href="../../../css/list.css" type="text/css"></link>
<script type="text/javascript" src="../../../js/jquery-1.2.6.js"></script>
</head>
<body>
	<div style="width: 360px; padding: 10px;">
		<div
			style="border-bottom: 1px solid #e8e8e8; text-align: left; font-size: 12px; margin-bottom: 12px; color: #9a9a9a">:::
			상품 일괄 구매처 이동하기</div>
		<form id="modify_bumun" method="post" action="modify_bumun.php" name='modify_bumun'>
			<input type="hidden" value="modify_bumun_query" name="mode"/>
			<?php
			for($i=0;$i<count($no);$i++){
			echo "<input type='hidden' name='chk_no[]' value='$no[$i]'/>";
			}
			?>	
			<div id=register>
				<ul class='line'></ul>
				<ul><li class='lable' style="width:100px;">부문 명</li>
					<li class='value' style="width:160px;padding-top:2px;">
						<select name="bumun_no" style="width:150px; margin-left:2px;font-size:11px;">
						<option value="-1">:: 부문 선택 ::</option>
						<?
						$qry = "SELECT * FROM uatp_bumun";
						$query = DBquery($qry);
						while($list = mysql_fetch_array($query)){
						?>
						<option value="<?=$list['no']?>"><?=$list['name']?></option>
						<?
						}
						mysql_close();
						?>
						</select>
					</li>
				</ul>
				<ul class='line'></ul>
			</div>

		<div style="padding: 5px;">
			<center>
			<input
				type='submit' class='button blue small' value='입력하기'/>
				<input type="button" class="button white small" value="취소하기"
					onclick="javacsript:window.close()" />
			</center>
		</div>
		</form>
	</div>
</body>
</html>